package com.bookshop.ui.component;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JOptionPane;
import javax.swing.JPanel;

import com.bookshop.ui.PageJumper;

public class BasePagePanel extends JPanel{
	private boolean mBackgroundOn = true;
	protected PageJumper mJumper;
	
	public BasePagePanel(PageJumper pJumper) {
		mJumper = pJumper;
		init();
	}
	
	public BasePagePanel(PageJumper pJumper, boolean pBackGroundOn) {
		mJumper = pJumper;
		init();
		mBackgroundOn = pBackGroundOn;
	}
	
	
	private void init() {
		setBounds(0, 0, 800, 600);
		setPreferredSize(new Dimension(800, 600));
		setBackground(Color.WHITE);
		setLayout(null);
	}
	
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
//		if (mBackgroundOn) {
//			MyImageIcon background = UIConstants.BACKGROUND;
//			g.drawImage(background.getImage(), 0, 0, this);
//		}
	}
	
	protected void showMessage(String pMessage) {
		JOptionPane.showMessageDialog(this, pMessage);
	}
	
	public void reload() {

	}

	public String getAccount() {
		return mJumper.getAccount();
	}
}
